package org.nowcoder.leetcode.BSearch;

/**
 * Title  : 153. Find Minimum in Rotated Sorted Array
 * Source : https://leetcode.cn/problems/find-minimum-in-rotated-sorted-array/description/
 * Author : XrazYang
 * Date   : 2023-10-30
 */

public class LeetCode_153 {
    public int findMin(int[] nums) {
        //最坏情况: O(n)
        int min = nums[0];
        if (nums.length > 1) {
            for (int i = 1; i < nums.length; i++) {
                if (min > nums[i]) {
                    min = nums[i];
                    break;
                }
            }
        }
        return min;
    }
}
